import 'package:flutter/material.dart';

class IndexView extends StatefulWidget {
	final String title;

	IndexView({Key key, this.title}) : super(key: key);

	@override
	_MyHomePageState createState() => new _MyHomePageState();

}

class _MyHomePageState extends State<IndexView> {
	int _counter = 0;

	void _incrementCounter() {
		setState(() {
			_counter++;
		});
	}

	@override
	Widget build(BuildContext context) {
		return new Scaffold(
			appBar: new AppBar(title: new Text(widget.title)),
			body: new Center(
				child: new Column(
					mainAxisAlignment: MainAxisAlignment.center,
					children: <Widget>[
						new Text('Yay'),
						new Text(
							'$_counter',
							style: Theme
								.of(context)
								.textTheme
								.display1,
						),
						new FlatButton(
							onPressed: () {
								Navigator.of(context).pushNamed('Other', arguments: 'M-M');
							},
							child: new Text('Open New Route'),
							textColor: Colors.redAccent
						),
						new FlatButton(
							onPressed: () {
								Navigator.pushNamed(context, 'Image');
							},
							child: new Text('Open New Route Image'),
							textColor: Colors.redAccent
						)
					],
				),
			),
			floatingActionButton: new FloatingActionButton(
				onPressed: _incrementCounter,
				tooltip: 'Add',
				child: new Icon(Icons.add),
			),
		);
	}
}